
public class PrefixSum 
{

	private int length;
	private int aray[];//=new int[20];
	private int prefixSum[];//=new int[20];
	
	public PrefixSum(int len)
	{
		length = len;
		aray = new int[length];
		prefixSum = new int[length];
		
	
	}
	 public void initArray()
	 {
		 
		 for(int i=0;i<length;i++)
		 {
			aray[i] = (17)*(int)(Math.random()*10); // random numbers
		 }
		 
		 for(int b=0;b<length;b++)
			{
				System.out.println("\n"+aray[b]);
			}
		 
	 }
	public void calcPreSum()
	{
		System.out.println(" preix sum ");
		for(int j=0;j<length;j++)
		{
			prefixSum[j]=0;
			for(int k=0; k<=j;k++)
			{
				prefixSum[j]+=aray[k];
			}
		}
	}
	 
public void printPreSum()
{
	for(int a=0;a<length;a++)
	{
		System.out.println("\n"+prefixSum[a]);
	}
}

}
